package framework.module.fileUpload.controller;

import com.google.zxing.WriterException;
import framework.common.ResponseVo;
import framework.util._QrcodeUtil;
import frameworkExt.util.controller.BaseControllerExt;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 吴宇亮 on 2019/3/28 0028 下午 4:37
 */
@Controller
@RequestMapping("/framework/module/fileUpload.do")
public class fileUploadController extends BaseControllerExt {

    @RequestMapping(params = "method=list")
    @ResponseBody
    public ResponseVo list(HttpServletRequest request, HttpServletResponse response) {
        String qrcodeMsg = request.getParameter("qrcodeMsg");
        try {
            String generatorPath = _QrcodeUtil.encoding(qrcodeMsg, 430, 430, "gif");
            return sendSuccess(generatorPath);
        } catch (IOException e) {
            e.printStackTrace();
            return sendError(e.getMessage());
        } catch (WriterException e) {
            e.printStackTrace();
            return sendError(e.getMessage());
        }
    }

}


































